<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    var arr=[1,6,8,9,7,3,2]
    function maxInArray(arr){
        arr.sort(function(a,b){
            return b-a;
        })
        return arr[0]
    }
    console.log("最大值是："+maxInArray(arr));
</script>